<?php

// +----------------------------------------------------------------------
// | Apprh.Shop
// +----------------------------------------------------------------------
// | Copyright (c) 2017-2027 http://www.apprh.com All rights reserved.
// +----------------------------------------------------------------------
// | Notice: This code is not open source, it is strictly prohibited
// |         to distribute the copy, otherwise it will pursue its
// |         legal responsibility.
// +----------------------------------------------------------------------
// | Author: pp <124910168@qq.com>
// +----------------------------------------------------------------------

namespace app\home\controller;

use controller\BasicHome;
use think\Db;

/**
 * 帮助中心
 * Class Help
 * @package app\home\controller
 * @author pp <124910168@qq.com>
 * @date 2020/12/15 10:41
 */
class Help extends BasicHome
{
    public function _initialize()
    {
        parent::_initialize();
    }

    //首页
    public function detail(){
        $id = input('id');
        $map = ['catid' => 7, 'status' => 1];
        if($id){
            $map['id'] = $id;
        }
        $info = $this->article->where($map)->find();
        Db::name('Article')->where(['id' => input('id')])->setInc('hits');

        //列表
        $lMap = ['catid' => 7, 'status' => 1];
        $list = $this->article->where($lMap)->select();

        //上一页
        // $prev = $this->article->where(['catid' => 7, 'status' => 1, 'id' => ['lt', $id]])->find();
        //下一页
        // $next = $this->article->where(['catid' => 7, 'status' => 1, 'id' => ['gt', $id]])->find();

        $data = [
            'info' => $info,
            'list' => $list,
            // 'prev' => $prev,
            // 'next' => $next,
        ];
        // halt($info);
        return $this->fetch('', $data);
    }
}
